//
//  JaneRegistViewController.m
//  EPA
//
//  Created by lanou3g on 16/4/26.
//  Copyright © 2016年 张静. All rights reserved.
//

#import "JaneRegistViewController.h"
#import "JaneNetWorkRequestManager.h"
@interface JaneRegistViewController ()
@property (weak, nonatomic) IBOutlet UITextField *emailTextField;
@property (weak, nonatomic) IBOutlet UITextField *unameTextField;
@property (weak, nonatomic) IBOutlet UITextField *passwordTextField;

@end

@implementation JaneRegistViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"t.jpeg"]];
    self.emailTextField.alpha = 0.5;
    self.unameTextField.alpha = 0.5;
    self.passwordTextField.alpha = 0.5;
        // Do any additional setup after loading the view from its nib.
}

- (IBAction)registBtnAction:(id)sender {
    [JaneNetWorkRequestManager requestURL:[NSURL URLWithString:REGIST_URL] RequestMethod:CK_POST Params:@{@"email":self.emailTextField.text,@"gender":@"0",@"uname":self.unameTextField.text,@"passwd":self.passwordTextField.text} Result:^(NSData *data, NSURLResponse *response, NSError *error) {
        if (data) {
            NSMutableDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
            NSDictionary *dataDict = jsonDict[@"data"];
            NSString *msg = jsonDict[@"data"][@"msg"];
            msg = msg?msg:@"登录成功";
            UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"提示" message:dataDict[@"msg"] preferredStyle:UIAlertControllerStyleAlert];
            [alertC addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]];
            dispatch_async(dispatch_get_main_queue(), ^{
                [self presentViewController:alertC animated:YES completion:nil];
            });
        }
    }];
}
- (IBAction)returnBtnAction:(id)sender {
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
